<template>
    <div>
       <headNav></headNav>
       <div class="head"></div>
       <div class="content" v-cloak>  
             <div class="con_body">
                <div class="art">
                    <div class="art_top">
                        <p class="art_tit">{{info.title}}</p>
                        <p class="date">发布时间：{{info.published_at}}</p>
                    </div>
                    <div class="mycon">
                         <div v-html="info.content"></div>
                    </div>
                     <!-- <div class="up_div" v-if="id==3" v-cloak>
                        <div v-if="id==3"  class="up_btn" @click="upload"></div>
                     </div> -->
                 </div>
             </div>
        </div>
       <footCom></footCom>
       
    </div>
  </template>
  
  <script>
import footCom from '@/common/foot.vue';
import headNav from '@/common/headNav.vue';

export default {
    name: 'thoughtArticle',
    components:{
     headNav,
     footCom,
  },
    data(){
      return{
          info:{},
          id:''
      }
    },
    created(){
        this.id = this.$route.query.id
        setTimeout(()=>{
            this.getInfo()
        },500)
    },
    computed:{
        isLoginSuccess(){
              return this.$store.state.isLoginSuccess
        },
   },
   watch: {
    $route:{
      handler(){
		// 初始化操作，这里边的操作可以把created钩子中的操作复制到这里一份。
       this.id = this.$route.query.id
        setTimeout(()=>{
            this.getInfo()
        },500)
      },
      immediate: true,
      deep: true,
    }
  },
    methods:{
        getInfo(){
          // 获取文章详情数据
          this.$axios.get('https://eduvideo.hangzhou.com.cn/api/v1/get_article/'+this.id).then(res=>{
            if(res.data.status =='success'){
                this.info = res.data.data
            }
          })
        },
        upload(){
            if(this.isLoginSuccess){
              this.$router.push('/upload')
            }else{
              this.$message({
                type: 'warning',
                message: '请先登录',
                duration: 2000
              });
            }
    },
    }
  }
</script>
<style scoped>

@import './../../public/css.css';
[v-cloak]{
  display: none;
}
</style>
  <!-- Add "scoped" attribute to limit CSS to this component only -->
  <style scoped>
  .art{
    width: 1200px;
    height: auto;
  }
  .con_body{
    width: 100%;
    height: auto;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-bottom: 100px;
  }
  .head{
    width: 100%;
    height: 586px;
    background: url('./../static/images/lml_banner.jpg') no-repeat center top;
  }
  .content{
    width: 100%;
    height: auto;
    background-size: 100% 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
  }
  .art_top{
    width: 100%;
    height: 180px;
    border-bottom: 1px solid #d8d8d8;
    padding-top: 70px;
    box-sizing: border-box;
  }
  .art_tit{
    color: #272727;
    font-size: 36px;
    font-weight: bolder;
    margin: 0;
    padding: 0;
   
  }
  .date{
    color: #272727;
    font-size: 18px;
    margin: 0;
    padding: 0;
    margin-top: 30px;
  }
  .up_btn{
    width: 545px;
    height: 95px;
    background: url('./../static/images/home_up_btn.png') no-repeat;
    background-size: 100% 100%;
    margin: 60px 0 90px 0;
    cursor: pointer;
    
  }
.up_div{
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 100%;
}
  </style>
  